#!/bin/bash
echo "Installation etc2git!!!"

source /etc/etc2git/etc2git.conf

HOSTNAME=`hostname`
DATE=`date`
GREEN='\e[32;1;1m'
NC='\e[0m'
echo -ne "${GREEN}\r
===============================================================================
 1. Make you repository                                                        
 $PROTOCOL://$BACKUPER:$BACKUPERPASS@$GOGSHOST/$BACKUPER/$PREFIX$T$HOSTNAME.git
 2. Change your /etc/etc2git/etc2git.conf                                      
 3. ENJOY ;-)                                                                  
                                    by Gordeev eXP10iT Aleksandr
===============================================================================
"

CONFILE=/etc/etc2git/etc2git.d/`date +%Y%m%d%H%M%S`.conf
echo BACKUPER='backuper'
read -p 'BACKUPER USER: ' BACKUPER
echo BACKUPERPASS='SecretPassword'
read -p 'BACKUPER PASSWORD: ' BACKUPERPASS
echo USEREMAIL='exp10it66@mail.io'
read -p 'USEREMAIL: ' USEREMAIL
echo PROTOCOL='http'
read -p 'PROTOCOL: ' PROTOCOL
echo GOGSHOST='uservis1.ru:3000'
read -p 'GOGSHOST: ' GOGSHOST
echo DIRTOBACKUP='/etc/'
read -p 'DIRTOBACKUP: ' DIRTOBACKUP
echo PREFIX='etc'
read -p 'PREFIX: ' PREFIX

touch $CONFILE
echo "BACKUPER='$BACKUPER'">>$CONFILE
echo "BACKUPERPASS='$BACKUPERPASS'">>$CONFILE
echo "USEREMAIL='$USEREMAIL'">>$CONFILE
echo "PROTOCOL='$PROTOCOL'">>$CONFILE
echo "GOGSHOST='$GOGSHOST'">>$CONFILE
echo "DIRTOBACKUP='$DIRTOBACKUP'">>$CONFILE
echo "PREFIX='$PREFIX'">>$CONFILE

echo -e "\e[0m"
